package com.esri.core.tasks.ags.geoprocessing;

import com.esri.core.internal.util.d;
import com.esri.core.tasks.ags.geoprocessing.GPParameter;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.JsonParser;
import org.codehaus.jackson.JsonToken;

/* loaded from: classes.dex */
public class GPMultiValue<T extends GPParameter> extends GPParameter {
    private static final long serialVersionUID = 1;
    ArrayList<T> parameters = new ArrayList<>();

    public GPMultiValue(String str) {
        setParamName(str);
        this.dataType = "GPMultiValue";
    }

    public List<T> getValues() {
        return this.parameters;
    }

    public void setValues(List<T> list) {
        this.parameters = (ArrayList) list;
    }

    public void addValue(T t) {
        this.parameters.add(t);
    }

    /* JADX WARN: Multi-variable type inference failed */
    @Override // com.esri.core.tasks.ags.geoprocessing.GPParameter
    public void fromJson(JsonParser jsonParser) throws Exception {
        while (jsonParser.nextToken() != JsonToken.END_ARRAY) {
            this.parameters.add(GPParameter.createFromJson(jsonParser));
        }
    }

    @Override // com.esri.core.tasks.ags.geoprocessing.GPParameter
    public String generateValueParams() throws Exception {
        StringWriter stringWriter = new StringWriter();
        JsonGenerator a = d.a(stringWriter);
        a.writeStartArray();
        Iterator<T> it = this.parameters.iterator();
        while (it.hasNext()) {
            a.writeString(it.next().generateValueParams());
        }
        a.writeEndArray();
        a.close();
        return stringWriter.toString();
    }

    public int hashCode() {
        ArrayList<T> arrayList = this.parameters;
        return 31 + (arrayList == null ? 0 : arrayList.hashCode());
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj != null && getClass() == obj.getClass()) {
            GPMultiValue gPMultiValue = (GPMultiValue) obj;
            ArrayList<T> arrayList = this.parameters;
            if (arrayList == null) {
                if (gPMultiValue.parameters != null) {
                    return false;
                }
            } else if (!arrayList.equals(gPMultiValue.parameters)) {
                return false;
            }
            return true;
        }
        return false;
    }
}
